package com.t.config;

import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;
import org.springframework.context.annotation.Configuration;

import java.util.concurrent.TimeUnit;

/**
 * @Author: tanghongjun
 * @DATE: 2025/4/2
 * @Description:
 */
@Configuration
public class GuavaConfig {

    public Cache<String, String> cache() {
        return CacheBuilder.newBuilder()
                .expireAfterWrite(3, TimeUnit.SECONDS)//写入后三秒过期
                .build();
    }
}
